<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <h:head>
        <title>ModeleRDP</title>
    </h:head>
    <h:body>
        <f:view>
            <h:form>
                 <p:panel id="panel" header="Models List" style="margin-bottom:10px;">
                     <center>
                      <p:commandButton value="NewModel" action="#{modelerdpMBean.creeRDP}" ajax ="false" />
                      <p:commandButton id="GraphicEditor" value="GraphicEditor" action="#{usersMBean.applet}" ajax="false"/> 
                      <p:commandButton id="Back" value="Back" action="#{usersMBean.choix}" ajax="false"/> 
                     </center>
                <p:dataTable value="#{modelerdpMBean.modelerdp}" var="item" 
                             emptyMessage="No model found with given criteria"   
                             widgetVar="modelerdpTable"  
                             paginator="true"  
                             rows="10">
                   
                        <f:facet name="header">
                            <h:outputText value="id model"/>  
                            <p:inputText id="globalFilter" onkeyup="modelerdpTable.filter()" style="width:150px" />    
                            
                        </f:facet>
                    
                      
                    
                     <p:column headerText="Idm"  
                              sortBy="#{item.idm}"  
                              filterBy="#{item.idm}"  
                              filterMatchMode="contains">  
                        <h:commandLink action="#{modelerdpMBean.showDetails(item)}" value="#{item.idm}"/>    
                    </p:column>
                    
                    
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Datec"/>
                        </f:facet>
                        <h:outputText value="#{item.datec}">
                            <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                        </h:outputText>
                    </p:column>
                   
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Login"/>
                        </f:facet>
                        <h:outputText value="#{item.login}"/>
                    </p:column>
                     <p:column>
                        <f:facet name="header">
                            <h:outputText value="Matricepre"/>
                        </f:facet>
                        <h:outputText value="#{item.matricepre}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Matricepost"/>
                        </f:facet>
                        <h:outputText value="#{item.matricepost}"/>
                    </p:column>
                    <p:growl id="message"/>
                    <p:column>
                    <f:facet name="header">Action</f:facet>
                    
                    <p:commandButton value="Delete" onclick="confirmation.show()" type="button" ajax ="false" />
      
                     <p:confirmDialog id="confirmDialog" message="Are you sure about destroying the module?" style=" align: center" 
                                 header="Initiating destroy the model" severity="alert" widgetVar="confirmation">  

                    <p:commandButton id="confirm" value="Yes Sure" update="messages" oncomplete="confirmation.hide()"  
                                     actionListener="#{modelerdpMBean.doDeleteModel}" />  
                    <p:commandButton id="decline" value="Not Yet" onclick="confirmation.hide()" type="button" />   

                 </p:confirmDialog> 
                    </p:column>    
                     <p:column>
                    <f:facet name="header">Action</f:facet>
                    <p:commandButton value="InitialMarking" action="#{modelerdpMBean.byIdm(item)}" ajax ="false" />
                  </p:column>  
                     <p:column>
                    <f:facet name="header">Action</f:facet>
                    <p:commandButton value="Draw"  action="#{modelerdpMBean.draw(item)}" ajax ="false" />
                  </p:column>  
                     
                     
                </p:dataTable>  
                    
                                      
                 </p:panel>
            </h:form>
        </f:view>
        
       

    </h:body>
   

</html>

